
package com.punch.common.feign;


import com.punch.common.constant.ServiceNameConstants;
import com.punch.common.feign.fallback.FeignStudentServiceFallbackFactory;
import com.punch.common.page.PageInfo;
import com.punch.common.vo.user.student.StudentPageVO;
import com.punch.common.vo.user.student.StudentVO;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestParam;


/**
 * 处理学生服务相关接口
 *
 * @author xiaol
 */

@FeignClient(name = ServiceNameConstants.USER_SERVICE, fallbackFactory = FeignStudentServiceFallbackFactory.class, decode404 = true)
public interface FeignStudentService {

    /**
     * 根据id查询学生信息
     *
     * @param userId    用户uid
     * @param studentId 学生id
     * @return StudentVO
     */
    @GetMapping(value = "/app-user/{userId}/student/{studentId}", produces = "application/json; charset=utf-8")
    StudentVO getFeignStudentById(@PathVariable("userId") Long userId, @PathVariable("studentId") Long studentId);


    /**
     * 学生列表
     */
    @GetMapping(value = "/students/feign/school/{schoolId}", produces = "application/json; charset=utf-8")
    PageInfo<StudentPageVO> feignStudentList(@PathVariable("schoolId") Long schoolId,
                                             @RequestParam("studentName") String studentName,
                                             @RequestParam("currPage") Integer currPage,
                                             @RequestParam("pageSize") Integer pageSize);

}

